from Globals import *
csock = None
callback = None
def run():
	global hook
	print "Test plugin"
	hook.registerHook('server_init', getClient)

def getClient(args):
	derp(args['clientsocket'])

class derp():
	def __init__(self,clientsocket):
		self.clientsocket = clientsocket
		hook.registerHook('playSong_before', self.psong)
		hook.registerHook('volumeDownCommand_before', self.vol)
		hook.registerHook('volumeUpCommand_before', self.vol)
		hook.registerHook('setCallback_before', self.setCallback)

	def psong(self,args):
		# volumeUpCommand_before
		self.clientsocket.send("[TESTPLUGIN] Received keywords: " + args['song'])

	def vol(self,args):
		if args['clientsocket'] == self.clientsocket:
			self.clientsocket.send("[TESTPLUGIN] Changed volume\n")

	def setCallback(self,args):
		callback = args['callback']